1. Field of the Invention
The present invention relates to the field of graphic layout methods and apparatuses, and more particularly to a constraint based graphics system for creating graphic layouts and for generating charts and graphs from data such as computer spreadsheet data.
2. Background Art
Computers are often used for numerical analysis. For these tasks, a computer program or system known as a "spreadsheet" is often used. In a computer spreadsheet system, data is arranged in a two dimensional grid of "cells" arranged in horizontal rows and vertical columns. The data content of cells may consist of text, numerical values, or arithmetic, statistical, or logical formulas that define the content of a cell in terms of the content of certain specified other cells. Examples of well known prior art spreadsheet programs are VisiCalc.RTM. from VisiCorp, Lotus 1-2-3.RTM. from Lotus Development Corporation, Excel.RTM. from Microsoft Corporation, and Quattro.RTM. from Borland International Inc.
FIG. 1 shows an example of a simple spreadsheet containing regional and total sales figures of a hypothetical company for the years 1988, 1989 and 1990. Vertical columns B, C and D contain sales data for each of the years 1988, 1989 and 1990, respectively. Horizontal columns 2-6 contain sales data for each of the North, South, East and West sales regions and for total sales, respectively.
In addition to displaying numerical data in the row and column format shown in FIG. 1, a spreadsheet system will often include subsystems that can display numerical data contained in spreadsheet cells in a graphical form. For example, prior art spreadsheet programs typically are able to generate bar charts, pie charts, and line graphs from data contained in selected spreadsheet cells. FIGS. 2 and 3 show examples of two types of bar charts that may be generated by spreadsheet programs of the prior art using the data of the spreadsheet of FIG. 1.
FIG. 2 shows a bar chart with four groups of vertical bars, one for each of the four sales regions North, South, East and West. Each group of bars contains three vertical bars for each of the sales years 1988, 1989, and 1990. The type of graph shown in FIG. 2 is useful for showing the relative changes in sales for each region over the three year period 1988 to 1990.
FIG. 3 shows a bar chart with a stacked bar for each of the four sales regions. Each stacked bar consists of three bars stacked on top of each other, one for each of the three years of the sales period. The heights of the stacked bars represent the total sales for each of the regions over the three year sales period. The type of graph shown in FIG. 3 is useful for comparing the cumulative sales of each region over the three year sales period.
Generating graphical charts from spreadsheet data involves (1) extracting the relevant numerical and text label data from appropriate spreadsheet cells and (2) transforming the data into a graphic image.
For example, to generate the bar chart of FIG. 2 from the spreadsheet data of FIG. 1, a user first identifies the data that is to be charted, typically by selecting the "range" of cells that contains the data (a "range" is a two dimensional contiguous block of spreadsheet cells). In this example, the appropriate range is is the rectangular group of cells from cell B2 to cell D5.
After the appropriate range of cells is identified, the spreadsheet system extracts the cell data needed to construct the desired graph. Data is typically extracted from the selected range on a row by row basis. For example, for the selected range B2 to D5 in FIG. 1, data may be extracted as four series of data values, one series for each of the four rows 2, 3, 4 and 5. For row 2 the appropriate series would be "19,800", "26,750" and "34,580". For row 3 the appropriate series would be "11,760", "13,450" and "13,760". For row 4 the appropriate series would be "28,670", "30,240" and "29,650". For row 5 the appropriate series would be "25,430", "29,760" and "36,780".
The selected data is transformed into a graphic image of a chart or graph by means of an appropriate "driver". A "driver" is a computer program or system that generates "draw" commands, using the selected data, for the graphic shapes and objects that form the individual components of the graph being created. These draw commands are sent to the computer's drawing subsystem, which, in response, draws geometric objects on the computer's display screen.
For example, the bar chart of FIG. 2 is made up of the following components: (a) rectangles 200a to 2001 that represent the twelve vertical bars; (b) vertical line 205 that represents the vertical axis; (c) horizontal line 210 that represents the horizontal axis; (d) short horizontal line segments 215a to 215e that represent the tick marks on the vertical axis; (e) vertical axis labels 220a to 220e; and (f) horizontal axis labels 225a to 225d. The size, position, and type of each of these components must be determined by the driver, and the proper command to draw each of the components at the correct size and position must be sent to the drawing subsystem. To draw rectangles, such as those that represent the vertical bars, the coordinates of the bottom left and top right corners must typically be provided to the drawing subsystem. For line segments, such as those representing the vertical and horizontal axes, the beginning and end point coordinates must be provided. The vertical axis labels must be calculated (typically by determining the maximum height of the bars, rounding off upwards, and dividing into sections in a predefined manner), and the positions of the text characters making up the horizontal and vertical axis labels must be specified. Information about each component is sent by the driver to the drawing subsystem, which draws the components, one by one, on the display screen.
In the prior art, a different "driver" is required for each type of graph or chart. For example, the stacked chart of FIG. 3 requires a different driver than the bar chart of FIG. 2. Accordingly, the types of graphs and charts available to a user are limited to the graphs and charts for which "drivers" are available. The more sophisticated the chart, the more complex (and therefore more costly, in terms of development time, memory usage, and execution time) the driver.